package cn.cxyxj;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

@RestController
public class HelloController {



    @RequestMapping("/open-feign-start")
    public String openFeignStart() throws InterruptedException {
        Thread.sleep(70000);
        return "open-feign-start";
    }

    @PostMapping("/json-params")
    public Params jsonParams(@RequestBody Params params){
        return params;
    }


    @PostMapping("/form-params")
    public Params formParams(Params params){
        return params;
    }

    @GetMapping("/getUserInfo/{id}")
    public String getUserInfo(@PathVariable("id") String userId){
        return userId;
    }

    @PostMapping("/addUser")
    public Params addUser(@RequestParam("id") String id, @RequestParam("name") String name){
        Params params = new Params();
        params.setParam1(name);
        params.setParam2(id);
        return params;
    }

    @GetMapping("/findByName")
    public String findByName(@RequestHeader("name") String userName){
        return userName;
    }


}
